package server

import (
	"rpc/model"
	"rpc/proto/order"
)

func CreateOrder(in *order.CreateOrderReq) (*model.Order, error) {
	stu := model.Order{
		OrderId:     in.OrderId,
		GoodsId:     in.GoodsId,
		OrderNumber: in.OrderNumber,
	}
	err := stu.CreateOrder()
	if err != nil {
		return nil, err
	}
	return &stu, nil
}
func GetOrder(in *order.GetOrderReq) ([]model.Order, error) {
	sty := model.Order{}
	getOrder, err := sty.GetOrder()
	if err != nil {
		return nil, err
	}
	return getOrder, nil
}
